﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>企业公告</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no" />
    <link href="../Frozenui1.3/css/frozen.css" rel="stylesheet" />
    <script src="../JS/layer/layer.m.js"></script>
    <script src="../JS/zepto.min.js"></script>
    <script src="../Frozenui1.3/js/frozen.js"></script>
    <script src="../JS/avalon.mobile.min.js"></script>
    <script src="../JS/MobileCom.js?v=1.1"></script>
    <script>
        document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
            //隐藏右上角按钮
            WeixinJSBridge.call('hideOptionMenu');
        });

        window.addEventListener('load', function () {

            var tab = new fz.Scroll('.ui-tab', {
                role: 'tab'
            });

            /* 滑动开始前 */
            tab.on('beforeScrollStart', function (from, to) {
                if ($(".ui-tab-nav li").eq(0).hasClass("current")) {
                    $(".ui-footer").show();
                }
                else {
                    $(".ui-footer").hide();
                }
            })

            /* 滑动结束 */
            tab.on('scrollEnd', function (curPage) {
                if ($(".ui-tab-nav li").eq(0).hasClass("current")) {
                    $(".ui-footer").show();
                }
                else {
                    $(".ui-footer").hide();
                }
            });

        })
        var strId = MobileCom.getQueryString("ID");
        var rwinfo = avalon.define({
            $id: "rwinfo",
            modelData: {},
            ydData: {},
            ydcount: 0,
            fjData: {},
            fjcount: 0,
            plData: {},
            plcount: 0
        });
        avalon.ready(function () {
            if (strId != null) {
                var lg = $.loading({
                    content: '加载中...',
                })
                $.getJSON('/API/WXAPI.ashx?Action=UPDATEQYGGREADUSER&r=' + Math.random(), { P1: strId }, function (data) {
                    if (data.ErrorMsg == "") {
                        $.getJSON('/API/WXAPI.ashx?Action=GETQYGGMODEL&r=' + Math.random(), { P1: strId }, function (resultData) {
                            lg.hide();
                            if (resultData.ErrorMsg == "") {
                                rwinfo.modelData = resultData.Result;
                                rwinfo.plData = resultData.Result1;
                                rwinfo.plcount = resultData.Result1.length;
                                rwinfo.fjData = resultData.Result2;
                                rwinfo.fjcount = resultData.Result2.length;
                                if (resultData.Result.ReadUser != null) {
                                    $.getJSON('/API/SZHLAPI.ashx?Action=GETUSERSBYUSERNAME&r=' + Math.random(), { P1: resultData.Result.ReadUser }, function (data) {

                                        if (data.ErrorMsg == "") {
                                            rwinfo.ydData = data.Result;
                                            rwinfo.ydcount = data.Result.length;
                                        }
                                    })
                                }
                            }
                        })
                    }
                    else {
                        lg.hide();
                    }
                })

            }

            $(".ui-btn").click(function () {
                if ($("#content").val() == null || $("#content").val() == "") {
                    $.tips({
                        content: "请输入评论内容",
                        stayTime: 2000,
                        type: "warn"
                    })
                    return;
                }
                var lg = $.loading({
                    content: '评论中...',
                })

                $.getJSON('/API/WXAPI.ashx?Action=ADDCOMENT&r=' + Math.random(), { "P1": $("#content").val(), "MsgType": "QYGG", "MsgLYID": strId }, function (resultData) {
                    lg.hide();
                    if (resultData.ErrorMsg == "") {
                        rwinfo.plData.push(resultData.Result);
                        rwinfo.plcount = rwinfo.plcount + 1;
                        var el = $.tips({
                            content: "评论成功！！",
                            stayTime: 2000,
                            type: "success"
                        })
                        $("#content").val("");
                    }
                    else {
                        var el = $.tips({
                            content: "评论失败！！",
                            stayTime: 2000,
                            type: "warn"
                        })
                    }
                })

            });

        })

        function back() {
            window.location.replace("UI_QYGG_LIST.html?r=" + Math.random());
        }
    </script>
    <style>
        .ui-list > li {
            margin: 3px;
            padding-left: 15px;
        }

        .ui-form-item .wspan {
            width: 100%;
            -webkit-box-sizing: border-box;
            box-sizing: border-box;
            -webkit-appearance: none;
            border: 0;
            background: 0 0;
            padding-left: 95px;
        }

        .ms-controller, [ms-controller] {
            display: none;
        }

        img {
            height: auto !important;
            width: auto\9 !important;
            width: 100% !important;
        }
        .ui-form-item .span {
            line-height: 1.5 !important;
            padding-bottom: 10px;
            overflow: hidden;
            word-wrap: break-word;
        }
    </style>
</head>
<body ms-controller="rwinfo">
    <header class="ui-header ui-header-stable ui-border-b">
        <i class="ui-icon-return" onclick="back()"></i><h1>企业公告查看</h1>
    </header>
    <div class="ui-footer ui-footer-stable ui-btn-group ui-border-t">
        <section class="ui-input-wrap ui-border-t" style="width:100%">
            <div class="ui-input ui-border-radius">
                <input id="content" type="text" name="" value="" placeholder="我也说一句...">
            </div>
            <button class="ui-btn">评论</button>
        </section>
    </div>
    <section class="ui-container">
        <div class="ui-form ui-border-t">
            <div class="ui-form-item ui-border-b">
                <label>
                    类型
                </label>
                <span class="wspan">{{modelData.remark}}</span>
            </div>
            <div class="ui-form-item ui-border-b" style="height:auto;min-height:44px">
                <label>
                    标题
                </label>
                <span class="wspan" style="overflow: hidden; word-wrap: break-word;">{{modelData.GGTitle}}</span>
            </div>
            <div class="ui-form-item ui-border-b" style="height:auto;min-height:44px">
                <label>
                    内容
                </label>
                <span class="wspan "></span>
                <p class="span" ms-if="modelData.GGContent" ms-html="modelData.GGContent"></p>
                <div style="clear: both"></div>
            </div>
            <div class="ui-form-item ui-border-b">
                <label>
                    创建人
                </label>
                <span class="wspan">{{modelData.CRUserName}}</span>
            </div>
            <div class="ui-form-item ui-border-b">
                <label>
                    创建时间
                </label>
                <span class="wspan">{{modelData.CRDate}}</span>
            </div>
            <div class="ui-form" style="display:none;">
                <ul class="ui-grid-halve">
                    <li>
                        <div class="ui-grid-halve-img">
                            <span style="background-image:url(http://placeholder.qiniudn.com/290x160)"></span>
                        </div>
                    </li>
                </ul>
            </div>
            <div class="ui-tab">
                <ul class="ui-tab-nav ui-border-b">
                    <li class="current">评论区({{plcount}})</li>
                    <li>已阅数({{ydcount}})</li>
                    <li>附件区({{fjcount}})</li>
                </ul>
                <ul class="ui-tab-content" style="width:300%;margin-top:0">
                    <li style="height:auto">
                        <div class="ui-form ui-border-t">
                            <ul class="ui-list ui-list-pure">
                                <li class="ui-border ui-label-list" ms-repeat-el="plData">
                                    <div style="display: -webkit-box;">
                                        <div class="ui-avatar-s">
                                            <span ms-css-background-image="url(/Upload/TX/{{el.CRUser}}.jpg)"></span>
                                        </div>
                                        <div class="ui-list-info">
                                            <h4>{{el.CRUserName}}</h4>
                                        </div>
                                        <div class="ui-list-info">
                                            <p>{{el.CRDate|date("yyyy-MM-dd HH:mm")}}</p>
                                        </div>
                                    </div>
                                    <p class="ui-txt-justify" ms-html="el.MSGContent"></p>
                                </li>
                            </ul>
                        </div>
                    </li>
                    <li style="height:0">
                        <ul class="ui-list ui-list-pure">
                            <li class="ui-border ui-label-list" style="padding-top:20px">
                                <label ms-repeat-el="ydData" class="ui-label" style="position: relative; width: auto;">{{el.UserRealName}}</label>
                            </li>
                        </ul>
                    </li>
                    <li style="height:0">
                        <div class="ui-form ui-border-t">
                            <ul class="ui-list ui-list-pure">
                                <li class="ui-border ui-label-list" ms-repeat-el="fjData">
                                    <div style="display: -webkit-box;">
                                        <div style="width:85%">
                                            <p class="ui-nowrap">{{el.Name}}.{{el.FileExtendName}}</p>
                                        </div>
                                        <div style="width:15%">
                                            <p>{{Math.round(el.FileSize/1024)}}kb</p>
                                        </div>
                                        <!--<div style="width:15%">
                                            <a ms-href="'http://mp.weixin.qq.com/mp/redirect?url='+ComFunJS.FilePathAPI+el.FileMD5+'?r=123#weixin.qq.com'" style="float:right" target="_blank">下载</a>
                                        </div>-->
                                    </div>
                                </li>
                            </ul>
                        </div>
                    </li>
                </ul>
            </div>
        </div>


    </section>
</body>
</html>
